<%--
  Created by IntelliJ IDEA.
  User: Think
  Date: 2022/11/4
  Time: 23:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<html>
<head><title>注册投票</title></head>
<body>
恭喜<%=request.getParameter("xm") %>,注册成功！
<jsp:useBean id="DB" class="db.conn" />
<form action="vote.jsp" method="post">
  <h2>请投票:</h2>
  <table border bordercolor="#0099ff">
    <tr>
      <th bgcolor="#CCFFFF">编号-人物</th>
    </tr>
    <form action="vote.jsp" method="post">
      <%
        Connection conn = DB.getConn();
        Statement stmt = DB.getStatement(conn);
        ResultSet rs = DB.getResultSet(stmt,"select * from vote");
        while(rs.next()){
          out.println("<tr>");
          out.println("<td><input type='radio' name='id' value='"+rs.getString("id")+"'>");
          out.println(rs.getString("id")+rs.getString("item")+"</td>");
          out.println("</tr>");
        }
        DB.close(conn);
        DB.close(stmt);
        DB.close(rs);
        session.setMaxInactiveInterval(-1);
      %>
      <tr><td><input type="submit" value="投票"></td></tr>
    </form>
  </table>
</body>
</html>
